/**
 * Copyright (C) 2018-2020
 * All rights reserved, Designed By www.kaikeba.co

 */
package com.kkb.shopcenter.controller;


import com.kkb.shopcenter.api.StoreSeckillService;
import com.kkb.shopcenter.common.common.HttpResult;
import com.kkb.shopcenter.common.pojo.StoreSeckill;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
* @author hadoop
*/
@RestController
@RequestMapping("api")
public class StoreSeckillController {

    @Reference
    private StoreSeckillService storeSeckillService;



    @ApiOperation(value = "列表")
    @GetMapping(value = "/getStoreSeckills")
    public HttpResult getStoreSeckills( Integer page, Integer size){
        Map<String, Object> map = storeSeckillService.queryAll(page+1, size);
        return HttpResult.success(map);
    }

    @PutMapping(value = "/storeSeckill")
    public HttpResult update(@Validated @RequestBody StoreSeckill resources){

        int result=storeSeckillService.saveOrUpdate(resources);
        return HttpResult.success(result);
    }

}
